home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
DEV
/
I-Z
/
ResExpress 1.0.sea
/
ResExpress 1.0
/
ResX DevKit
/
Think Pascal
/
ResX Utils.p
< prev
next >
Wrap
Text File
|
1991-07-06
|
8KB
|
169 lines
{ResX Utils is a library to be used for ResX externals and views.}
{It can only be used with ResX and any attempt to use it with another}
{project may be very hazardous to your health because it relies on the}
{presents of ResX to work.}
unit ResXUtils; {Version 1.1}
interface
type
SettingsHandle = ^SettingsPtr; {Contains Configuration setup, last and second}
SettingsPtr = ^SettingsRec; {to last files opened, and last move info}
SettingsRec = record
unused1: Boolean;
openStartup: Boolean; {Enable/Disable Open on Startup options}
sortTList, sortRList: Boolean; {Sort Type/Resource list}
lastOneRefNum, lastTwoRefNum: integer; {Last/Second to last volume reference number}
lastOneName, lastTwoName: Str255; {Last/Second to last file name}
lastMoveType: ResType; {TYPE of the last resource copied}
lastMoveID: integer; {Resource ID of the last resource copied}
lastMoveSource, lastMoveDest: Str255; {Source and Dest Files of the last resource copied}
onStartup: integer; {Open on startup option: 1-Last File, 2-Last Two Files, 3-Open File Dialog}
unused2: integer;
dClick: integer; {Current selected item of DoubleClick popup menu}
helpFName: Str255; {Location of master Help file}
end;
GlobalsHndl = ^GlobalsPtr; {ResX Global Data - Some data can be programmably}
GlobalsPtr = ^GlobalsRec; {altered. Alter with care! * denotes DO NOT alter}
GlobalsRec = record
theDevCtlEnt: DCtlPtr; {*Device Control Entry for DA*}
rsrcBase: Integer; {*Resource Base*}
daMenu: MenuHandle; {Main DA Menu}
daFileID: Longint; {*File ID of DA*}
LeftFName, RightFName: Str255; {Path and Name of Left & Right files currently opened}
LeftVNum, RightVNum: integer; {vRefNum of Left & Right files}
LWasOpened, RWasOpened: Boolean; {Left/Right file was opened priorly and shouldn't be closed}
LcurType, RcurType: ResType; {Current type displayed above resource lists}
LTcurCell, RTcurCell: Cell; {Current selected cell in Left/Right TYPE list}
LRcurCell, RRcurCell: Cell; {Current selected cell in Left/Right RESOURCE list}
LfileID, RfileID: integer; {Left/Right File ID}
prefsID: integer; {File ID of ResX Prefs in the System Folder}
CompactLeft, CompactRight: Boolean; {Left/Right resource map will be compacted when closed if TRUE}
favMenu, extMenu, openMenu: MenuHandle; {*Favorite File/Externals/Open File MenuHandles}
Lopen, Ropen: Boolean; {True if Left/Right file is open and displayed in ResX}
MFActive: Boolean; {*True if MultiFinder is running*}
Settings: SettingsHandle; {Handle to Settings in Configuration setup}
LTypeList: ListHandle; {Handle to Left Type list}
RTypeList: ListHandle; {Handle to Right Type list}
LResList: ListHandle; {Handle to Left Resource list}
RResList: ListHandle; {Handle to Right Resource list}
Info: ControlHandle; {Get Info Button Control Handle}
View: ControlHandle; {View Button Control Handle}
OpenLeft: ControlHandle; {Open Left Button Control Handle}
OpenRight: ControlHandle; {Open Right Button Control Handle}
Remove: ControlHandle; {Remove Button Control Handle}
Copy: ControlHandle; {Copy Button Control Handle}
end; {DO NOT alter globals denoted with *. They can}
{be accessed for reference only.}
{ResX Toolbox}
procedure CenterWindow (theWindow: WindowPtr);
procedure GetCenterPoint (var thePoint: Point);
procedure MoveBWindow (theWindow: WindowPtr; PrevWindowRect: Rect; var windFlag: Boolean);
function ShortFName (LongName: Str255): Str255;
procedure GetDirInfo (vRefNum: Integer; vName: StringPtr; var wdDirID: Longint);
function TestColor: Boolean;
function TrackRect (theRect: Rect): Boolean;
{Internal Alerts -}
{ The following Alerts allow direct access to the Alerts internal to ResX. When a }
{ message or question is passed in, the Alert resources inside of ResX are used. }
{ This simplifies writing externals for ResX by leaps and bounds since the }
{ developer does not need to program for these common procedures.}
function OKCancel (Message: Str255): boolean; {TRUE if OK is clicked, FALSE if Cancel is clicked}
procedure OKAlert (Message: Str255);
function YesNoCancel (Question: Str255): integer; { Yes=1, No=0, Cancel=-1}
function SelectFile: integer;
{SelectFile -}
{ This function checks to see if a file is opened within ResX. If only one file is opened, }
{ it's fileID will be returned. If two files are opened, a dialog will appear and ask to select}
{ file. The fileID of the file selected will be returned. If the user cancels from the dialog,}
{ a zero will be returned. If no files are opened, a -1 will be returned.}
{ }
{ The resource to the dialog exists inside of ResX.}
{ Result Codes: }
{ -1: No file open.}
{ 0: Cancel was selected.}
{ >0: fileID of the file selected.}
function TrapAvailable (theTrap: Integer): Boolean;
{TrapAvailable -}
{ Determines if a toolbox trap is available. theTrap is the trap address to test.}
{ Example:}
{ if TrapAvailable(_OSDispatch) then .....}
{Super Memory Manager}
{The Super Memory Manager is the best of the standard memory routines and the}
{Temporary memory routines. It tests to see if the Temporary Memory Routines}
{exists and uses it if there is more memory available in the free space than in the }
{current heap. If the blockSize requested is not available, it returns 90% of the}
{maximum available memory that can be obtained from either the current heap or}
{the free space heap, whichever is greater.}
{HType is used by the Super Memory Manager to determine what type of handle was}
{created. HType must NOT be altered at any time. It is necessary to dispose of a}
{SuperHandle properly.}
function SuperNewHandle (blockSize: Size; var HType: Boolean; var resultCode: OSErr): Handle;
{SuperNewHandle - }
{ blockSize - requested amount of memory to create a handle for. If the requested amount}
{ is not available, 90% of the available memory is returned.}
{ HType - returns the type of handle that was created. True if Temporary, False if Standard.}
{ Do not alter HType! Alway use it to pass into Lock,Unlock and Dispose procedures.}
{ resultCode- the standard MemError result.}
{ RETURNS - a standard Handle.}
{}
{ If blockSize requested is not available, 90% of the maximum available memory is used.}
{ Use SizeOf(myHandle) to determine the size of the handle if needed.}
procedure SuperHLock (theHandle: Handle; HType: Boolean; var resultCode: OSErr);
{SuperHLock - }
{ theHandle - the Super handle to lock}
{ HType - the type of handle provided by SuperNewHandle.}
{ resultCode- the standard MemError result.}
procedure SuperHUnLock (theHandle: Handle; HType: Boolean; var resultCode: OSErr);
{SuperHUnLock - }
{ theHandle - the Super handle to UNlock}
{ HType - the type of handle provided by SuperNewHandle.}
{ resultCode- the standard MemError result.}
procedure SuperDisposHandle (theHandle: Handle; HType: Boolean; var resultCode: OSErr);
{SuperDisposHandle - }
{ theHandle - the Super handle to Dispose of.}
{ HType - the type of handle provided by SuperNewHandle.}
{ resultCode- the standard MemError result.}
implementation
end.